package com.example.tingsugar.mapper;

import com.example.tingsugar.bean.PayItemRateBean;
import com.example.tingsugar.bean.PayRechargeRangeBean;
import com.example.tingsugar.bean.PayVipDurationRateBean;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author lzc
 * @Date 2023/4/16 16:32
 */
public interface PayMapper {
    @Select("SELECT\n" +
        "    pay_item_name,\n" +
        "    sum(pay_amount) AS pay_amount\n" +
        "FROM dws_pay_item_window\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY pay_item_name")
    List<PayItemRateBean> statsPayItem(Integer date);
    
    @Select("SELECT\n" +
        "    vip_duration,\n" +
        "    sum(vip_duration_user_ct) AS user_ct\n" +
        "FROM dws_pay_vip_window\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY vip_duration")
    List<PayVipDurationRateBean> statsVipDurationRate(Integer date);
    
    @Select("SELECT\n" +
        "    recharge_amount_range,\n" +
        "    sum(recharge_ct) AS recharge_ct\n" +
        "FROM dws_pay_recharge_window\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY recharge_amount_range")
    List<PayRechargeRangeBean> statsRechargeRangeRate(Integer date);
    
}
